//区间合并板子
vector<pair<int,int>> merge(vector<pair<int,int>> *a)
{
    vector<pair<int,int>>ans;
    sort(a->begin(),a->end());
    int tl = (*a)[0].first, tr = (*a)[0].second;
    for(int i=1;i<a->size();i++)
    {
        if((*a)[i].first <= tr) tr = (*a)[i].second;
        else
        {
            ans.push_back(pair(tl,tr));
            tl = (*a)[i].first;
            tr = (*a)[i].second;
        }
    }
    if(tr == (*a)[(a)->size()-1].second)
    {
        ans.push_back(pair(tl,tr));
    }
    return ans;
}